package com.xsr.controller;

import com.xsr.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

/**
 * @author 邢式瑞
 * @version 1.0
 * @project springMvc02
 * @date 2022/9/8 17:21
 */
@Controller
public class Servlet01 {
    @RequestMapping("test01")
    public  ModelAndView  test01(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("name","张三");
        return modelAndView;
    }
    @RequestMapping("test02")
    public  String test02(Map map){
        map.put("name","xing");
        return "hello";
    }
    @RequestMapping("test03")
    public  String test03( Integer i){
        System.out.println(i);

        return "hello";
    }
    @PutMapping("User")
    public  void update(User user){
        System.out.println(user);
    }
    @PostMapping("User")
    public  void insert(User user)
    {
        System.out.println("添加成功"+user);
    }
    @GetMapping("User")
    public void select(Integer id){
        System.out.println("查询到"+id);
    }
    @DeleteMapping("User")
    public  void delete(Integer id){

        System.out.println("删除了");
    }
}
